//
//  WYPlaceholderView.m
//  WYModel
//
//  Created by ios on 2017/3/3.
//  Copyright © 2017年 Wy. All rights reserved.
//

#import "WYPlaceholderView.h"

@implementation WYPlaceholderView


-(instancetype)init{
    self  = [self init];
    if (self) {
        
    }
    return self;
}

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if ( self) {
        
    }
    return self;
}

-(void)wyPlaceholderImage:(UIImage *)image withTitle:(NSString *)title buttonTitle:(NSString *)btnTitle{
    //此处图片根据自己需要制定
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth/2-75, kHeight/2-110, 150, 150)];
    imageView.image        = image;
    
    [self addSubview:imageView];
    
    UILabel *label       = [[UILabel alloc] initWithFrame:CGRectMake(20, kHeight/2+48, kWidth-40, 21)];
    label.text           = title;
    label.textColor      = [UIColor lightGrayColor];
    label.textAlignment  = NSTextAlignmentCenter;
    
    [self addSubview:label];
    
    UIButton *btn         = [[UIButton alloc] buttonWithTitle:btnTitle ImageName:nil Frame:CGRectMake(kWidth/2-60, kHeight/2+100, 120, 30)];
    btn.layer.borderWidth = 0.6;
    btn.layer.borderColor = [UIColor lightGrayColor].CGColor;
    [btn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(BtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self addSubview:btn];
    
}

-(void)BtnClick{
    
    self.block();//按钮回调
    
}

// 在控制器中初始化的时候调用  刷新界面
//self.block = ^(){
//
//};


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
